import 'package:FineArt/utils/size_config.dart';
import 'package:flutter/material.dart';
import 'package:FineArt/constants.dart';

class RoundedTextWithDel extends StatelessWidget {
  final String label;
  final Function press;
  final Color backgroundColor, textColor;
  final Decoration decoration;
  final bool selected;
  final int fontSize;
  final int height;
  final double width;
  static const BoxDecoration _boxDecoration = BoxDecoration();

  const RoundedTextWithDel(
      {Key key,
      this.label,
      this.press,
      this.backgroundColor = bg_input,
      this.textColor = Colors.white,
      this.decoration = _boxDecoration,
      this.selected = true,
      this.fontSize = 13,
      this.height = 30,
      this.width = 150})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    Size size = MediaQuery.of(context).size;
    return Container(
      padding: EdgeInsets.symmetric(horizontal: 2, vertical: 0),
      height: 30,
      width: width,
      child: Row(crossAxisAlignment: CrossAxisAlignment.start, children: [
        ClipRRect(
          borderRadius: BorderRadius.circular(20),
          child: Container(
            color: selected ? category_bg_selected : category_bg_unselected,
            padding: EdgeInsets.symmetric(vertical: 1, horizontal: 5),
            alignment: Alignment.center,
            child: InkWell(
              onTap: press,
              child: Text(
                label,
                style: TextStyle(
                    color: selected
                        ? category_text_selected
                        : category_text_unselected,
                    fontSize: setSp(fontSize)),
              ),
            ),
          ),
        ),
        Container(
          height: 20,
          width: 20,
          child: Stack(
            children: [
              Positioned(
                top: 2,
                right: 0,
                child: InkWell(
                  onTap: press,
                  child: ClipOval(
                      child: Container(
                    color: Color.fromARGB(0xff, 0xff, 0x8B, 0x00),
                    padding: EdgeInsets.symmetric(vertical: 2, horizontal: 4),
                    child: Image.asset("assets/images/icon_delete_white.png"),
                    width: getPortraitSWidth(20),
                    height: getPortraitSHeight(15),
                  )),
                ),
              )
            ],
          ),
        )
      ]),
    );
  }
}
